﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Color x:Key="BlackColor">#FF000000</Color>
    <Color x:Key="AccentColor">#CC119EDA</Color>
    <Color x:Key="AccentColor2">#99119EDA</Color>

    <SolidColorBrush x:Key="SliderThumbDisabled" Color="#FFA0A0A0" />
    <SolidColorBrush x:Key="SliderTrackNormal" Color="#FFC6C6C6" />
    <SolidColorBrush x:Key="BlackBrush" Color="{StaticResource BlackColor}" />
    <SolidColorBrush x:Key="SliderTrackHover" Color="#FFD0D0D0" />
    <SolidColorBrush x:Key="AccentColorBrush" Color="{StaticResource AccentColor}"/>
    <SolidColorBrush x:Key="AccentColorBrush2" Color="{StaticResource AccentColor2}"/>


    <Style x:Key="SliderButtonStyle" TargetType="RepeatButton">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="IsTabStop" Value="false" />
        <Setter Property="Focusable" Value="false" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RepeatButton">
                    <Grid Background="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderThumbStyle" TargetType="Thumb">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid Background="{TemplateBinding Background}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderTickBarStyle" TargetType="TickBar">
        <Setter Property="Fill" Value="{DynamicResource SliderThumbDisabled}" />
        <Setter Property="Visibility" Value="Collapsed" />
        <Style.Triggers>
            <Trigger Property="Placement" Value="Top">
                <Setter Property="Height" Value="6" />
                <Setter Property="Margin" Value="0,0,0,3" />
            </Trigger>
            <Trigger Property="Placement" Value="Bottom">
                <Setter Property="Height" Value="6" />
                <Setter Property="Margin" Value="0,3,0,0" />
                <Setter Property="Grid.Row" Value="2" />
            </Trigger>

            <Trigger Property="Placement" Value="Left">
                <Setter Property="Width" Value="6" />
                <Setter Property="Margin" Value="0,0,3,0" />
            </Trigger>
            <Trigger Property="Placement" Value="Right">
                <Setter Property="Width" Value="6" />
                <Setter Property="Margin" Value="3,0,0,0" />
                <Setter Property="Grid.Column" Value="2" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="FlatSlider" TargetType="Slider">
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="Orientation" Value="Horizontal" />
        <Setter Property="Foreground" Value="{DynamicResource AccentColorBrush}" />
        <Setter Property="Background" Value="{DynamicResource SliderTrackNormal}" />
        <Setter Property="BorderBrush" Value="{DynamicResource BlackBrush}" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Slider">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" MinHeight="{TemplateBinding Slider.MinHeight}" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TickBar x:Name="TopTick" Style="{StaticResource SliderTickBarStyle}" Placement="Top" />
                        <Track Grid.Row="1" x:Name="PART_Track">
                            <Track.DecreaseRepeatButton>
                                <RepeatButton Style="{StaticResource SliderButtonStyle}"
                                              Command="Slider.DecreaseLarge"
                                              Background="{TemplateBinding Slider.Foreground}"
                                              Height="{TemplateBinding Slider.Height}" />
                            </Track.DecreaseRepeatButton>
                            <Track.Thumb>
                                <Thumb Height="{TemplateBinding Slider.Height}"
                                       Width="{TemplateBinding Slider.Height}"
                                       Style="{StaticResource SliderThumbStyle}"
                                       Background="{TemplateBinding Slider.BorderBrush}" />
                            </Track.Thumb>
                            <Track.IncreaseRepeatButton>
                                <RepeatButton Style="{StaticResource SliderButtonStyle}"
                                              Command="Slider.IncreaseLarge"
                                              Background="{TemplateBinding Slider.Background}"
                                              Height="{TemplateBinding Slider.Height}" />
                            </Track.IncreaseRepeatButton>
                        </Track>
                        <TickBar x:Name="BottomTick" Style="{StaticResource SliderTickBarStyle}" Placement="Bottom" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TickPlacement" Value="TopLeft">
                            <Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="BottomRight">
                            <Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="Both">
                            <Setter TargetName="TopTick" Property="Visibility" Value="Visible" />
                            <Setter TargetName="BottomTick" Property="Visibility" Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Foreground" Value="{DynamicResource AccentColorBrush2}" />
                <Setter Property="Background" Value="{DynamicResource SliderTrackHover}" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>